package cn.com.okgo.request;

import android.text.TextUtils;
import android.util.Log;

import cn.com.okgo.request.base.BaseRequest;
import cn.com.okgo.utils.HttpUtils;
import okhttp3.Request;
import okhttp3.RequestBody;

/**
 * Created by luwenlong on 2017/6/1.
 */

public class GetRequest<T> extends BaseRequest<T, GetRequest> {

    public GetRequest(String url) {
        super( url );
    }

    @Override
    protected RequestBody generateRequestBody() {
        return null;
    }

    @Override
    public Request generateRequest(RequestBody requestBody) {
        String realUrl = TextUtils.isEmpty( baseUrl ) ? url : baseUrl + url;
        realUrl = HttpUtils.createUrlFromParams( realUrl, params.urlParamsMap );
        okhttp3.Request.Builder requestBuilder = new okhttp3.Request.Builder();
        return HttpUtils.appendHeaders( requestBuilder, headers ).url( realUrl ).tag( tag ).build();
    }
}
